import QtQuick 1.1
import com.nokia.meego 1.0

import "Logic.js" as Logic

/**** Idea from the SystemInfo, Thanks to the author !!! ****/

Page {
    id: splashPage
    //anchors.margins: 32
    orientationLock: PageOrientation.LockPortrait

    tools: ToolBarLayout {
        id: tool
        visible: true

        Label {
            id: l_link
            anchors.horizontalCenter: parent.horizontalCenter
            anchors.verticalCenter: parent.verticalCenter
            font.pixelSize: 19
            font.italic: true
            opacity: 1
            text: "<a href='https://projects.developer.nokia.com/meewords'>http://projects.developer.nokia.com/meewords</a>"
            Behavior on opacity { NumberAnimation { duration: 1000 } }
            onLinkActivated: { Qt.openUrlExternally (link) }
        }
    }


    Timer {
        property int tick: 0
        id: timer1
        interval: 500;
        running: true;
        repeat: true
        onTriggered: {
            tick++;
            //if(tick == 1) image1.opacity = 1
            //if(tick == 2) text1.opacity = 1
            if(tick == 6) { image1.opacity = bottom.opacity = l_link.opacity = 0 }
            if(tick == 8) {
                Logic.openFile("MainPage.qml");
                running = false
            }
        }
    }

    BackgroundPage { }

    MouseArea {
        id: maPage
        anchors.centerIn: parent
        anchors.fill: parent
        //==================
        Item {
            id: col
            anchors.horizontalCenter: parent.horizontalCenter
            anchors.verticalCenter: parent.verticalCenter
            anchors.fill: parent


            Image {
                id: image1
                opacity: 1
                //source: "images/categories.png"
                source: "images/categories-blue.png"
                smooth: true
                //width: 200
                //height: 240
                width: 180
                height:180
                anchors.horizontalCenter: parent.horizontalCenter
                anchors.top: parent.top
                anchors.topMargin: 100
                Behavior on opacity { NumberAnimation { duration: 1000; easing.type: Easing.OutQuad } }
            }
            Item {
                id: space
                width: 32; height: 32
            }
            Text {
                id: text1
                opacity: 1
                text: "MeeWords"
                anchors.horizontalCenter: parent.horizontalCenter
                anchors.top: parent.top
                anchors.topMargin: 400
                font.pixelSize: 68
                style: Text.Outline
                styleColor: "blue"
                color: "#4e6fff"
                font.family: "Nokia Pure Text"
                font.bold: true
                Behavior on opacity { NumberAnimation { duration: 1200 } }

            }

        }


        Text {
            anchors.bottom: parent.bottom
            anchors.bottomMargin: 80
            anchors.horizontalCenter: parent.horizontalCenter
            text: "Click to skip"
            color: "gray"
        }



        //==================
        onClicked: {
            Logic.openFile("MainPage.qml");
            timer1.running = false
        }
    }

}
